<?php

namespace Framework;

use Framework\Session;

/**
*
*授权类
*
*/
class Authorisation{
    /**
    *
    *检查当前登录的用户是否拥有指定资源的所有权
    *
    */
    public static function isOwner($resourceId){
        $sessionUser = Session::get('user');

        if ($sessionUser !==null && isset($sessionUser['id'])) {
            $sessionUserId = (int) $sessionUser['id'];

            return $sessionUserId === $resourceId;
        }

        return false;
    }
}